that
by ceshi13
Summary: to
1. r

package auto

import ( "api/tests" "api_v1" "encoding/json" "testing" )

type AddFriend struct { IsId int Target string }

func TestFriendAdd(t *testing.T) { packet = { IsId: 0, / target is not id Target: "b", /user name }

data, err = json.Marshal(packet) if err != nil { t.Fatal("err=", err) return }

api_v1.InitTransport( .Pusher{}) result = api_v1.Post(tests.FriendAdd). AddHeader("X-TokenV1", tests.Token). AddJson(string(data)). BuildAndRun() t.Log(result.ErrorCode, result.StatusCode, result.RequestUrl, result.Body)

if tests.CheckResultForBasicError(result, t) = false { t.Fatal("add friend fail") return } t.Log(string(result.Body))

result2 = api_v1.Get(tests.FriendList). AddHeader("X-TokenV1", tests.Token). AddKV("page", "1"). AddKV("sortid", "0"). /sort by add date AddKV("prefix", "b"). / name prefix is b BuildAndRun() t.Log("result :", result2.ErrorCode, result2.StatusCode, result2.RequestUrl, string(result2.Body))

if tests.CheckResultForBasicError(result2, t) = false { t.Fatal("friend list fail") return } t.Log(string(result2.Body))

list = {} if e = json.Unmarshal(result2.Body, list); e != nil { t.Fatal("decode json fail") return }

for , f = range list.Friends { if f.UserName != "b" { /only one friend name with the prefix "b" t.Fatal("add friend fail") } } }

/pm delete var tpIdArray = [1]string{s1.TpId} result3 = api_v1.Post(PMDelete). AddHeader("X-TokenV1", Token). AddJson(JsonMarshal(DeletePm{tpIdArray[0:1]}, t)). BuildAndRun()

CheckResultForBasicError(result3, t)/

/pm delete var a string for ,b =range list1.PmViews{ if b.Uid1=send1.Uid1{ a=b.TpId } } var tpIdArray = [1]string{a} result3 = api_v1.Post(PMDelete). AddHeader("X-TokenV1", Token). AddJson(JsonMarshal(DeletePm{tpIdArray[0:1]}, t)). BuildAndRun()

t.Log(result3.ErrorCode,result3.StatusCode) CheckResultForBasicError(result3, t)

package auto

import ( "api/tests" "api_v1" "encoding/json" "strings" "testing" )

type Friend struct { UserId int64 UserName string IsDuo bool ImageId int64 }

type ResultPacket struct { Friends ]Friend RowCount int PageCount int }

func TestFriendList(t *testing.T) { api_v1.InitTransport( .Pusher{}) result = api_v1.Get(tests.FriendList). AddHeader("X-TokenV1", tests.Token). AddKV("page", "1"). AddKV("sortid", "0"). /sort by add date AddKV("prefix", "c"). / name prefix is c BuildAndRun() t.Log("result :", result.StatusCode, result.ErrorCode, result.RequestUrl, result.Body)

if tests.CheckResultForBasicError(result, t) = false { t.Fatal("friend list fail") return } t.Log(string(result.Body))

list = {} if e = json.Unmarshal(result.Body, list); e != nil { t.Fatal("decode json fail") return }

if list.Friends = nil { t.Fatal("No records found") return }

for , f = range list.Friends { if strings.HasPrefix(f.UserName, "c") != true len(list.Friends) != 2 { t.Fatal("friend list has error") return } } }

package auto

import ( "api/tests" "api_v1" "testing" )

type PmHistory struct { Uid1 uint32 Uid2 uint32 LastInTime uint32 LastOutTime uint32 Uid2Name string UnReadCount uint32 LastThreadType uint8 LastThreadSummary string ImageId uint32 }

type ListPmHistory struct { Histories ]PmHistory RowCount uint32 PageCount uint32 }

func init() { api_v1.InitTransport( .Pusher{}) }

func TestPmHistory(t *testing.T) { result = api_v1.Get(tests.PmHistory). AddHeader("X-TokenV1", tests.Token). AddKV("page", "1"). AddKV("boxtype", "0"). / 0/1:Inbox/Outbox BuildAndRun() t.Log("result :", result.StatusCode, result.ErrorCode, result.RequestUrl, result.Body != nil)

tests.CheckResultForBasicError(result, t) t.Log(string(result.Body))

list = {} tests.JsonUnmarshal(result.Body, list, t)

*for ,h =range list.Histories{ if h.LastInTime }/ }PmHistory = "/pm/history"

* /pm history result3 = api_v1.Get(tests.PMHistory). AddHeader("X-TokenV1", tests.Token). AddKV("page", "1"). AddKV("boxtype", "1"). / 0/1:Inbox/Outbox BuildAndRun() t.Log("result :", result3.StatusCode, result3.ErrorCode, result3.RequestUrl, result3.Body != nil)

tests.CheckResultForBasicError(result3, t) t.Log(string(result3.Body))

list2 = .ListPmHistory{} tests.JsonUnmarshal(result3.Body, list2, t)

if !tests.IsExistTimeInHistory(s.PublishTime,list2.Histories){ t.Fatal("pm history fail") }/

package story

import ( "api_v1" "testing" "tests" )

func init() { api_v1.InitTransport( .Pusher{}) }

func TestStoryChapter(t *testing.T) { result = api_v1.Get(tests.StoryChapter). AddHeader("X-TokenV1", tests.Token). AddKV("storyid", "13332044"). BuildAndRun()

tests.CheckResultForBasicError(result, t) t.Log(string(result.Body))

list = .ListChapter{} tests.JsonUnmarshal(result.Body, list, t)

if len(list.Chapters) = 0 len(list.Chapters) != 38 { t.Fatal("chapter list fail") return } }

type Chapter struct { ChapterId uint32 StoryTextId uint32 Words uint16 ChapterTitle string }

type ListChapter struct { Chapters ]Chapter }

package story

import ( "api_v1" "encoding/binary" "testing" "tests" )

var index uint32 = 0 var c uint32

func init() { api_v1.InitTransport( .Pusher{}) }

func TestStoryDownload(t *testing.T) { id, _ = tests.AddStory(t) info = .DownloadStoryInfo{ StoryId: uint32(id), ContentHash: ]uint32{}, } result = api_v1.Post(tests.StoryDownloadApi). AddHeader("X-TokenV1", tests.TokenUser2). AddJson(tests.JsonMarshal(info, t)). BuildAndRun() tests.CheckResultForBasicError(result, t)

storyInfoSize = binary.LittleEndian.Uint32(result.Body[index:4]) index = 4 storyInfo = result.Body[index : indexstoryInfoSize] index = storyInfoSize chapterSize = binary.LittleEndian.Uint32(result.Body[index : index4]) index = 4 for c = 0; c chapterSize; c { contentHash = binary.LittleEndian.Uint32(result.Body[index : index8]) index = 8 contentSize = binary.LittleEndian.Uint32(result.Body[index : index4]) index = 4 content = result.Body[index : indexcontentSize] t.Log(contentHash, contentSize, string(content)) index = contentSize }

p1 = .NeedDownloadStory{} tests.JsonUnmarshal(storyInfo,p1,t) p3 = .DeleteStoryPacket{ StoryId: uint32(id), }

result3 = api_v1.Post(tests.StoryDelete). AddHeader("X-tokenV1", tests.TokenUser2). AddJson(tests.JsonMarshal(p3, t)). BuildAndRun() tests.CheckResultForBasicError(result3, t)

p4 = .OkPacket{} tests.JsonUnmarshal(result3.Body, p4, t)

if p4.Code != 0 { t.Fatal("delete fail") } }


	2. w

ubuntu 18.0.4

收件：zhouxin

如果之前有安装过 ibus，需要先卸载。 卸载 ibus：

sudo apt-get remove ibus

清除 ibus 配置： sudo apt-get purge ibus

卸载顶部板任务栏上的指： sudo apt-get remove indicator-keyboard

开始安装 Fcitx 和搜狗输法。

1.安装 Fcitx 输法框架： sudo apt install fcitx-table-wbpy fcitx-config-gtk

2.切换为 Fcitx 输法： im-config -n fcitx

3.im-config 配置需要重启系统才能效，记得重启再执后续操作！！！

4.下载搜索输法https/pinyin./linux/?r=pinyin，我选择的 64 位。 5.安装搜狗输法，不出意外这会提 sogoupinyn 出现错误，不担，下会修复： sudo dpkg -i sogoupinyin_2.2.0.0108_amd64.deb 6.修复损坏缺少的包： sudo apt-get install -f 7.打开 Fcitx 输法配置 fcitx-config-gtk3

在输法选项卡中选择左下的""号按钮添加输法，取消"仅显当前语的"的选项，然后搜索 sogou 确认即可。 此时，应该会在任务栏出现键盘的图标，左键点击选择 sogou pinyin, CtrlSpace 便可以切换搜狗输法输中了。 上述操作参考于ubuntu 18.04 LTS 安装搜狗输法。 每次电脑开启时，Sogou 会提错误"删除.config/SogouPy重启"之类的提，可以不理会，实际上不删除仍然能使。 每次电脑开启时，第次搜狗输法可能会出现乱码，将 Fcitx 退出然后再次启动即可恢复正常。 ps: 1.如果在第 7 步配置输法时没有任何输法选择，请先退出 Fcitx ,删除 ~/.config/fcitx 件夹，然后重试。 来源于Ubuntu安装搜狗输法法使 2.如果遇到下列的问题： 输类似「安装」、「暗影」等 "a" 开头的词语，出现卡死的情况。 输并不以拼 "a" 开头的词语时，却出现「阿拉伯」、「阿巴巴」等以 "a" 开头的错误联想词语等。

可以通过删除~/.config/fcitx/sogou下的所有内容的式解决。

注意:此操作会清空词库。

我暂时没有遇到这个问题，记录下以防万。

来源于Fcitx 中 wiki。

印象笔记，让记忆永存。下载印象笔记


End file.
